<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  <head>
    <th:block th:replace="~{/_include/header}" />
    <meta name="page-help" content="https://getrebuild.com/docs/admin/privileges" />
    <title>[[${bundle.L('角色权限')}]]</title>
    <style>
      .table.table-priv {
        table-layout: fixed;
        border: 0 none;
        border-bottom: 1px solid #dee2e6;
      }
      .table.table-priv td,
      .table.table-priv th {
        padding: 9px 6px;
        vertical-align: middle;
        text-align: center;
        line-height: 1;
        font-weight: normal;
        position: relative;
      }
      .table.table-priv th {
        border-top: 0 none;
        color: #777;
      }
      .table.table-priv th a:hover,
      .table.table-priv .name a:hover {
        opacity: 0.8;
      }
      .table.table-priv td.name {
        text-align: left;
      }
      .priv,
      .table.table-priv.table-fields .R4.R0 {
        width: 30px;
        height: 18px;
        display: inline-block;
        background: url([[${baseUrl}]]/assets/img/role/role_0.gif) no-repeat center center;
      }
      .priv:hover {
        cursor: pointer;
        opacity: 0.8;
      }
      .R1 {
        background-image: url([[${baseUrl}]]/assets/img/role/role_1.gif);
      }
      .R2 {
        background-image: url([[${baseUrl}]]/assets/img/role/role_2.gif);
      }
      .R3 {
        background-image: url([[${baseUrl}]]/assets/img/role/role_3.gif);
      }
      .R4 {
        background-image: url([[${baseUrl}]]/assets/img/role/role_4.gif);
      }
      .legend {
        border: 1px solid #dee2e6;
        border-radius: 3px;
        display: inline-block;
        padding: 9px 15px;
      }
      .legend label {
        margin: 0 6px;
      }
      .legend .priv {
        width: 22px;
        float: left;
      }
      .legend-wrap {
        padding: 10px 0 5px;
        text-align: right;
      }
      .table.table-priv td > a.cp,
      .name > span > a {
        position: absolute;
        left: 50%;
        margin-left: 15px;
        margin-top: 2px;
        font-size: 15px;
        color: #999 !important;
        display: none;
      }
      .table.table-priv tr:hover > td > a.cp,
      .table.table-priv td > a.cp.active,
      .name > span > a.active,
      .table.table-priv tr:hover .name > span > a {
        display: inline-block;
      }
      .table.table-priv td > a.cp.active,
      .table.table-priv td > a.cp:hover,
      .name > span > a.active,
      .name > span > a:hover {
        color: #4285f4 !important;
      }
      .name > span > a {
        font-size: 16px;
        left: unset;
        margin-left: 10px;
        margin-top: -2px;
      }
      .nav-tabs li {
        position: relative;
      }
      .nav-tabs .badge {
        position: absolute;
        top: -1px;
        right: -1px;
        font-size: 0.8462rem;
        font-weight: normal;
        line-height: 1.2;
      }
      .aside-2tree h5 {
        padding: 0 10px;
        margin: 0;
        line-height: 30px;
        color: #b0b0b0;
        font-weight: 600;
      }
    </style>
  </head>
  <body>
    <div class="rb-wrapper rb-fixed-sidebar rb-collapsible-sidebar rb-collapsible-sidebar-hide-logo rb-aside rb-color-header" th:classappend="${sideCollapsedClazz}">
      <th:block th:replace="~{/_include/nav-top}" />
      <th:block th:replace="~{/_include/nav-left-admin(active='role-privileges')}" />
      <div class="rb-content">
        <aside class="page-aside">
          <div class="rb-scroller">
            <div class="page-aside-tree" id="role-tree">
              <div class="aside-2tree hide-collapse">
                <ul class="list-unstyled m-0">
                  <li th:each="R : ${Roles}" th:class="${R[0] == RoleId ?'active':''}" th:if="${!R[2]}">
                    <a th:data-id="${R[0]}" class="text-ellipsis">[[${R[1]}]]</a>
                  </li>
                  <h5 th:if="${hasDisabled}">[[${bundle.L('已禁用')}]]</h5>
                  <li th:each="R : ${Roles}" th:class="${R[0] == RoleId ?'active':''}" th:if="${R[2]}">
                    <a th:data-id="${R[0]}" class="text-ellipsis">[[${R[1]}]]</a>
                  </li>
                </ul>
              </div>
            </div>
          </div>
        </aside>
        <div class="main-content container-fluid">
          <div class="alert alert-warning alert-icon alert-icon-border alert-dismissible alert-sm hide J_tips">
            <div class="icon"><span class="zmdi zmdi-info-outline"></span></div>
            <div class="message">
              <a class="close" data-dismiss="alert"><span class="zmdi zmdi-close"></span></a>
              <p>ALERT</p>
            </div>
          </div>
          <div class="float-right">
            <button class="btn btn-secondary btn-space J_new-role mr-0" type="button"><i class="icon mdi mdi-lock-plus"></i> [[${bundle.L('新建角色')}]]</button>
            <div class="btn-group btn-space ml-1" th:if="${id != null}">
              <button class="btn btn-primary J_save" type="button">[[${bundle.L('保存')}]]</button>
              <button class="btn btn-primary dropdown-toggle w-auto" type="button" data-toggle="dropdown"><i class="icon zmdi zmdi-chevron-down"></i></button>
              <div class="dropdown-menu dropdown-menu-primary dropdown-menu-right">
                <a class="dropdown-item J_copy-role"><i class="icon zmdi zmdi-copy"></i> [[${bundle.L('复制角色')}]]</a>
              </div>
            </div>
          </div>
          <div class="tab-container">
            <ul class="nav nav-tabs nav-tabs-classic">
              <li class="nav-item"><a data-toggle="tab" href="#priv-entity" class="nav-link active">[[${bundle.L('实体权限')}]]</a></li>
              <li class="nav-item"><a data-toggle="tab" href="#priv-zero" class="nav-link">[[${bundle.L('扩展权限')}]]</a></li>
              <li class="nav-item hide"><a data-toggle="tab" href="#tab-members" class="nav-link">[[${bundle.L('使用用户')}]]</a></li>
            </ul>
            <div class="tab-content mb-0">
              <div class="tab-pane active" id="priv-entity">
                <table class="table table-hover table-priv">
                  <thead>
                    <tr>
                      <th class="text-left" width="25%">[[${bundle.L('业务实体')}]]</th>
                      <th><a data-action="C" th:title="${bundle.L('批量选择')}">[[${bundle.L('新建')}]]</a></th>
                      <th><a data-action="R" th:title="${bundle.L('批量选择')}">[[${bundle.L('读取')}]]</a></th>
                      <th><a data-action="U" th:title="${bundle.L('批量选择')}">[[${bundle.L('编辑')}]]</a></th>
                      <th><a data-action="D" th:title="${bundle.L('批量选择')}">[[${bundle.L('删除')}]]</a></th>
                      <th><a data-action="A" th:title="${bundle.L('批量选择')}">[[${bundle.L('分配')}]]</a></th>
                      <th><a data-action="S" th:title="${bundle.L('批量选择')}">[[${bundle.L('共享')}]]</a></th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr th:each="entity : ${Entities}">
                      <td class="name">
                        <a th:data-entity="${entity[1]}" th:data-name="${entity[0]}" th:title="${bundle.L('批量选择')}">[[${entity[2]}]]</a>
                        <span class="bosskey-show">
                          <a th:data-entity="${entity[1]}" th:title="${bundle.L('字段权限')}"><i class="mdi mdi-form-textbox-lock mdi-sort-variant-lock--"></i></a>
                        </span>
                      </td>
                      <td><i data-action="C" class="priv R0"></i><a></a></td>
                      <td>
                        <i data-action="R" class="priv R0"></i>
                        <a data-action="R9" class="cp" th:title="${bundle.L('自定义权限')}"><i class="mdi mdi-filter-check-outline"></i></a>
                      </td>
                      <td>
                        <i data-action="U" class="priv R0"></i>
                        <a data-action="U9" class="cp" th:title="${bundle.L('自定义权限')}"><i class="mdi mdi-filter-check-outline"></i></a>
                      </td>
                      <td>
                        <i data-action="D" class="priv R0"></i>
                        <a data-action="D9" class="cp" th:title="${bundle.L('自定义权限')}"><i class="mdi mdi-filter-check-outline"></i></a>
                      </td>
                      <td>
                        <i data-action="A" class="priv R0"></i>
                        <a data-action="A9" class="cp" th:title="${bundle.L('自定义权限')}"><i class="mdi mdi-filter-check-outline"></i></a>
                      </td>
                      <td>
                        <i data-action="S" class="priv R0"></i>
                        <a data-action="S9" class="cp" th:title="${bundle.L('自定义权限')}"><i class="mdi mdi-filter-check-outline"></i></a>
                      </td>
                    </tr>
                  </tbody>
                </table>
                <p th:if="${Entities.size() == 0}" class="text-muted mt-5">[[${bundle.L('暂无可用业务实体')}]]</p>
                <div class="legend-wrap">
                  <div class="legend">
                    [[${bundle.L('图例')}]]
                    <label><i class="priv R0"></i> [[${bundle.L('无权限')}]]</label>
                    <label><i class="priv R1"></i> [[${bundle.L('本人')}]]</label>
                    <label><i class="priv R2"></i> [[${bundle.L('本部门')}]]</label>
                    <label><i class="priv R3"></i> [[${bundle.L('本部门及子部门')}]]</label>
                    <label><i class="priv R4"></i> [[${bundle.L('全部')}]]</label>
                  </div>
                </div>
              </div>
              <div class="tab-pane" id="priv-zero">
                <table class="table table-hover table-priv">
                  <thead>
                    <tr>
                      <th class="text-left" width="25%">[[${bundle.L('权限项')}]]</th>
                      <th><a data-action="Z">[[${bundle.L('允许')}]]</a></th>
                      <th class="text-left">[[${bundle.L('前置条件')}]]</th>
                      <th></th>
                      <th></th>
                      <th></th>
                      <th></th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td class="name"><a data-name="AllowLogin">[[${bundle.L('允许登录')}]]</a></td>
                      <td><i data-action="Z" class="priv R4"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('无')}]]</td>
                    </tr>
                    <tr>
                      <td class="name"><a data-name="AllowCustomNav">[[${bundle.L('允许自定义导航菜单')}]]</a></td>
                      <td><i data-action="Z" class="priv R4"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('无')}]]</td>
                    </tr>
                    <tr>
                      <td class="name"><a data-name="AllowCustomChart">[[${bundle.L('允许自定义仪表盘、图表')}]]</a></td>
                      <td><i data-action="Z" class="priv R4"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('无')}]]</td>
                    </tr>
                    <tr>
                      <td class="name"><a data-name="AllowCustomDataList">[[${bundle.L('允许自定义列显示')}]]</a></td>
                      <td><i data-action="Z" class="priv R4"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('需具备相应实体的读取权限')}]]</td>
                    </tr>
                    <tr>
                      <td class="name"><a data-name="AllowBatchUpdate">[[${bundle.L('允许批量修改')}]]</a></td>
                      <td><i data-action="Z" class="priv R0"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('需具备相应实体的编辑权限')}]]</td>
                    </tr>
                    <tr>
                      <td class="name">
                        <a data-name="AllowRecordMerge">[[${bundle.L('允许记录合并')}]]</a>
                        <sup class="rbv"></sup>
                      </td>
                      <td><i data-action="Z" class="priv R0"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('需具备相应实体的编辑和/或删除权限')}]]</td>
                    </tr>
                    <tr>
                      <td class="name">
                        <a data-name="AllowRevokeApproval">[[${bundle.L('允许撤回、撤销审批')}]]</a>
                        <sup class="rbv"></sup>
                      </td>
                      <td><i data-action="Z" class="priv R0"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('需具备相应实体的读取权限')}]]</td>
                    </tr>
                    <tr>
                      <td class="name">
                        <a data-name="AllowDataImport">[[${bundle.L('允许数据导入')}]]</a>
                        <sup class="rbv"></sup>
                      </td>
                      <td><i data-action="Z" class="priv R0"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('需具备相应实体的新建和/或编辑权限')}]]</td>
                    </tr>
                    <tr>
                      <td class="name"><a data-name="AllowDataExport">[[${bundle.L('允许数据导出')}]]</a></td>
                      <td><i data-action="Z" class="priv R0"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('需具备相应实体的读取权限')}]]</td>
                    </tr>
                    <tr>
                      <td class="name">
                        <a data-name="AllowNoDesensitized">[[${bundle.L('允许查看明文')}]]</a>
                        <sup class="rbv"></sup>
                      </td>
                      <td><i data-action="Z" class="priv R0"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('针对信息脱敏字段可查看明文')}]]</td>
                    </tr>
                    <tr>
                      <td class="name"><a data-name="AllowAtAllUsers">[[${bundle.L('允许在动态中 @所有人')}]]</a></td>
                      <td><i data-action="Z" class="priv R0"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('无')}]]</td>
                    </tr>
                    <tr>
                      <td class="name">
                        <a data-name="EnableBizzPart">[[${bundle.L('开启部门用户隔离')}]]</a>
                        <sup class="rbv"></sup>
                      </td>
                      <td><i data-action="Z" class="priv R0"></i></td>
                      <td colspan="5" class="text-muted text-left">[[${bundle.L('无')}]]</td>
                    </tr>
                  </tbody>
                </table>
                <div class="legend-wrap">
                  <div class="legend">
                    [[${bundle.L('图例')}]]
                    <label><i class="priv R4"></i> [[${bundle.L('是')}]]</label>
                    <label><i class="priv R0"></i> [[${bundle.L('否')}]]</label>
                  </div>
                </div>
              </div>
              <div class="tab-pane" id="tab-members"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <th:block th:replace="~{/_include/footer}" />
    <script>
      window.__PageConfig = {
        recordId: '[[${id}]]',
      }
    </script>
    <th:block th:replace="~{/_include/forms}" />
    <script th:src="@{/assets/js/bizuser/role-view.js}" type="text/babel"></script>
    <script th:src="@{/assets/js/bizuser/role-privileges.js}" type="text/babel"></script>
  </body>
</html>
